<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <%@ include file="/share/systemInclude.jsp" %>
   
   <script type="text/javascript">
      $(function(){  
        $(".list_table").colResizable({
          liveDrag:true,
          gripInnerHtml:"<div class='grip'></div>", 
          draggingClass:"dragging", 
          minWidth:30
        }); 
      });
      
      function search(id){
      	$('#'+id).submit();
      }
      
      function editStatus(value,title,id,name){
      	art.dialog({
			width: 250,
			height: 100,
			fixed: true,
		    padding: 0,
		    title: title+"提示",
		    content: "是否确认<font style='color:red'>"+title+"</font>店铺 "+name+" ？",
		    lock: true,
		    button: [{
			    name: "确定",
			    callback: function () {
			    	$.ajax({
						 url: "${root}/control/shop/shopController/editStatus.do?shopId="+id,
						 data: {
						 	"shopStatus":value
						 },
						 type: "post",
						 success: function(data){
				        	if(data=="true"){
				        		var url = '${root }/control/shop/shopController/sysShopList.do?page=${pageView.currentpage}&';
								var param = $('#searchForm').serialize();
								url = url+param;
				        		artDalog(title+"提示","店铺 "+name+" "+title+"成功",url);
				        		//search("searchForm");
				        	}else{
				        		artDalog("错误信息","店铺 "+name+" 不存在，无法"+title+"！",null);
				        	}
				      	}
				   	});
			    },
		        focus: true
		     },
		     {
		        name: "取消"
		     }]
		});
      }
   </script>
   <title>Document</title>
 </head>
 <body>
  <div class="container">
    <div id="search_bar" class="">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">搜索</b></div>
            <div class="box_center pt10 pb10">
            	<form id="searchForm" action="${root }/control/shop/shopController/sysShopList.do" method="post">
			  		<table class="form_table" border="0" cellpadding="0" cellspacing="0">
			  			<tr>
			  				<td>店铺名称:</td>
			  				<td><input type="text" name="shopName" value="${fn:escapeXml(form.shopName)}" class="input-text lh30" size="40" /></td>
			  				<td>联系人:</td>
			  				<td><input type="text" name=shopContact value="${fn:escapeXml(form.shopContact)}"  class="input-text lh30" size="40" /></td>
			  				<td>城市:</td>
			  				<td>
			  					<span class="fl">
			                      <div class="select_border"> 
			                        <div class="select_containers ">
			                        <c:if test="${not empty cityList }">
			                        	<select name="cityId" class="select" style="width:150px;">
				                        	<option value="">Please Choose!</option>
				                        	<c:forEach items="${cityList }" var="city">
				                        		<option value="${city.cityId }" <c:if test="${form.cityId == city.cityId }">selected="selected"</c:if>>${fn:escapeXml(city.cityName)}</option>	
				                        	</c:forEach>
				                        </select>
			                        </c:if>
			                        <c:if test="${empty cityList }">
			                        	<select name="cityId" class="select" >
				                        	<option>请先进行城市管理</option>
				                        </select>
			                        </c:if>
			                        </div> 
			                      </div> 
			                    </span>
			  				</td>
			  				<td><input type="button" name="button" class="btn btn82 btn_search" onclick="search('searchForm');" value="查询"> </td>
			  			</tr>
			  		</table>
			  	</form>
            </div>
          </div>
        </div>
    </div>
    <div class="box_bottom pb5 pt5 pr10 mt10">
       <div class="search_bar_btn" style="text-align:left;">
          <a href="${root }/control/shop/shopController/dispalySysAdd.do" class="ext_btn"><span class="add"></span>添加</a>
       </div>
     </div>
     <div id="table" class="">
        <div class="box span10 oh">
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
                   <th width="50">编辑</th>
                   <th width="60">店铺名称</th>
                   <th width="100">店铺Logo</th>
                   <th width="60">联系人</th>
                   <th width="180">地址</th>
                   <th width="80">电话</th>
                   <th width="40">保障金</th>
                   <th width="100">创建时间</th>
                   <th width="45">状态</th>
                   <th width="140">操作</th>
                </tr>
                <c:if test="${not empty pageView.records }">
	  				<c:forEach items="${pageView.records }" var="entity">
	  					<tr class="tr">
		                   <td align="center"><input type="button" name="button" class="btn btn82 btn_add" onclick="window.location.href='${root }/control/shop/shopController/dispalySysEdit.do?shopId=${entity.shopId }'" value="编辑"></td>
		                   <td>${fn:escapeXml(entity.shopName)}</td>
		                   <td align="center"><img src="${imageService }${entity.shopLogo}" width="100" height="100" /></td>
		                   <td><span title="${fn:escapeXml(entity.shopContact)}">${fn:escapeXml(entity.shopContact)}</span></td>
		                   <td><span title="${fn:escapeXml(entity.shopAddress)}">${fn:escapeXml(entity.shopAddress)}</span></td>
		                   <td>${entity.contactTel }</td>
		                   <td align="center">
		                   		<c:if test="${entity.shopBondStatus == 1 }">未交</c:if>
                    			<c:if test="${entity.shopBondStatus == 2 }">已交</c:if>
		                   </td>
		                   <td align="center"><fmt:formatDate value="${entity.shopCreateTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		                   <td align="center">
		                   		<c:if test="${entity.shopStatus == 1}">使用中</c:if>
		                   		<c:if test="${entity.shopStatus == 2}">冻结中</c:if>
		                   		<c:if test="${entity.shopStatus == 3}">已删除</c:if>
		                   </td>
		                   <td>
		                   		<c:if test="${entity.shopStatus == 1}">
		                   			<input type="button" name="button" class="btn btn82 btn_res" onclick="editStatus('2','冻结','${entity.shopId}','${entity.shopName }')" value="冻结">
		                   			<input type="button" name="button" class="btn btn82 btn_del" onclick="editStatus('3','删除','${entity.shopId}','${entity.shopName }')" value="删除">
		                   		</c:if>
	                   			<c:if test="${entity.shopStatus == 2}">
	                   				<input type="button" name="button" class="btn btn82 btn_res" onclick="editStatus('1','恢复','${entity.shopId}','${entity.shopName }')" value="恢复">
		                   			<input type="button" name="button" class="btn btn82 btn_del" onclick="editStatus('3','删除','${entity.shopId}','${entity.shopName }')" value="删除">
	                   			</c:if>
	                   			<c:if test="${entity.shopStatus == 3}"></c:if>
		                   </td>
		                </tr>
	  				</c:forEach>
	  			</c:if>
	  			<c:if test="${empty pageView.records }">
	  				
	  			</c:if>
              </table>
              <%@ include file="/share/systemPagination.jsp" %>
        </div>
     </div>
   </div> 
 </body>
 </html>
  